import request from "@/libs/request";

const basePath = '/appcloud-dashboard' ;

export const apiUrls = {
    deleteAlarmRule : basePath + '/api/alamrManager/deletAlarmRule/',
    deleteAlarmLinkMan : basePath + '/api/alamrManager/deleteAlarmLinkMan/',
    getAlarmRulesInfo : basePath + '/api/alamrManager/getAlarmRulesInfo/',
    getDicInfo : basePath + '/api/alamrManager/getDicInfo',
    getAlarmLinkMan : basePath + '/api/alamrManager/listResultResultBody/',
    pageAlarmContactMan : basePath + '/api/alamrManager/pageAlarmContactMan',
    pageAlarmRulesList : basePath +'/api/alamrManager/pageAlarmRulesList',
    saveAlarmContactMan : basePath + '/api/alamrManager/saveAlarmContactMan',
    saveAlarmRule : basePath + '/api/alamrManager/saveAlarmRule',
    sendCheckCode : basePath + '/api/alamrManager/sendCheckCode',
    updateAlarmRule : basePath +'/api/alamrManager/updateAlarmRule',
    updateAlarmRuleStatus : basePath +'/api/alamrManager/updateAlarmRuleStatus/',
}

//删除报警规则
export async function deleteAlarmRule(ruleId){
	return request( apiUrls.deleteAlarmRule + ruleId, {
      method:'GET'
  })
}
//删除报警联系人
export async function deleteAlarmLinkMan(id) {
    return request(apiUrls.deleteAlarmLinkMan + id, {
        method:'GET'
    })
}
//通过id查询报警规则
export async function getAlarmRulesInfo(id) {
    return request(apiUrls.getAlarmRulesInfo + id, {
        method:'GET'
    })
}
//查询规则字段信息
export async function getDicInfo() {
    return request(apiUrls.getDicInfo, {
        method:'GET'
    })
}
//查询报警联系人
export async function getAlarmLinkMan(linkName) {
    return request(apiUrls.getAlarmLinkMan + linkName,{
        method:'GET'
    })
}
//分页查询报警联系人
export async function pageAlarmContactMan(params) {
    return request(apiUrls.pageAlarmContactMan,{
        method:'POST',
        body:params
    })
}
//分页查询报警规则列表
export async function pageAlarmRulesList(params) {
    return request(apiUrls.pageAlarmRulesList, {
        method:'POST',
        body:params
    })
}
//保存报警联系人
export async function saveAlarmContactMan(params) {
    return request(apiUrls.saveAlarmContactMan , {
        method:'POST',
        body:params
    })
}
//保存报警规则
export async function saveAlarmRule(params) {
   return request(apiUrls.saveAlarmRule , {
       method:'POST',
       body:params
   })
}
//获取验证码
export async function sendCheckCode(params) {
    return request(apiUrls.sendCheckCode , {
        method:'POST',
        body:params
    })
 }
 //修改报警规则
 export async function updateAlarmRule(params) {
    return request(apiUrls.updateAlarmRule , {
        method:'POST',
        body:params
    })
 }
 //修改报警规则状态ruleId规则ID, Status状态(0,禁用，1启用)
 export async function updateAlarmRuleStatus(ruleId,ruleStatus) {
    return request(apiUrls.updateAlarmRuleStatus + `${ruleId}/${ruleStatus}`, {
        method:'GET'
    })
 }